﻿namespace _策略模式
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Context context = new Context(new ConcreteStrategyA());
            context.ContextInterface();
            Context context1 = new Context(new ConcreteStrategyB());
            context1.ContextInterface();
            Context context2 = new Context(new ConcreteStrategyC());
            context2.ContextInterface();
            Console.ReadLine();
        }
    }
    /// <summary>
    /// 策略
    /// </summary>
    public abstract class Strategy
    {
        public abstract void AlgorithmInterface();
    }
    public class ConcreteStrategyA : Strategy
    {
        public override void AlgorithmInterface()
        {
            Console.WriteLine("算法A实现");
        }
    }
    public class ConcreteStrategyB : Strategy
    {
        public override void AlgorithmInterface()
        {
            Console.WriteLine("算法B实现");
        }
    }

    public class ConcreteStrategyC : Strategy
    {
        public override void AlgorithmInterface()
        {
            Console.WriteLine("算法C实现");
        }
    }
    public class Context
    {
        private Strategy _strategy;
        public Context(Strategy strategy)
        {
            _strategy = strategy;
        }
        public void ContextInterface()
        {
            _strategy.AlgorithmInterface();
        }
    }


    #region 取号打印模拟

    public abstract class Print
    {

    }

    #endregion



}
